﻿create PROCEDURE Sync.SP_Committees_SelectChanges
@LastRowVersion rowversion,
@FilterdColumn UNIQUEIDENTIFIER
AS 
BEGIN 
	SELECT 
        t.[CommitteeID],
		g.[CommitteeName],g.[CenterID],g.[IsMainCommittee],
		t.IsDeleted,
		t.LastUpdatedDate
	FROM [dbo].[Committees] g RIGHT JOIN Sync.Committees_Tracking t  
    ON t.CommitteeID = g.CommitteeID 
	WHERE (@LastRowVersion IS NULL OR t.Version > @LastRowVersion)
        AND (@FilterdColumn IS NULL OR g.CommitteeID = @FilterdColumn)
    END














